import QtQuick 2.0
import QtQuick.Controls 1.1
import "../FKWidget/"

FKWidget{
    id:fkyesno
    relativeWidth: 0.4
    relativeHeight: 0.4

    property alias text: txt.text

    signal yes
    onYes: hide()
    signal no
    onNo: hide()

    function ask(question){
        text=question
        show()
    }

    FKViewport{
        Text{
            id:txt
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            anchors{
                left:parent.left
                right:parent.right
                top:parent.top
                bottom:buttons.top
                margins: 10
            }
            wrapMode: Text.Wrap
        }
        Item{
            id:buttons
            anchors{
                left:parent.left
                right:parent.right
                bottom:parent.bottom
                margins: 10
            }
            height: yesButton.height
            Button{
                id:yesButton
                text:qsTr("Yes")
                onClicked: fkyesno.yes()
                anchors{
                    left:parent.left
                    bottom:parent.bottom
                }
                width:parent.width*0.5-5
            }
            Button{
                id:noButton
                text:qsTr("No")
                onClicked: fkyesno.no()
                anchors{
                    right:parent.right
                    bottom:parent.bottom
                }
                width:parent.width*0.5-5
            }
        }
    }
}
